#ifndef DISPATCHER_HANDLER_H
#define DISPATCHER_HANDLER_H
#include <Arduino.h>
#include "Scheduler.h"
#include "I2CSlave.h"
#include "DataStorage.h"
#include "lwmp.h"
#include "SMCEngine.h"



// typedef struct{
//     union{
//         uint16_t value;
//         uint8_t data[2];
//     };
// }compose_handler_data_t;

            // compose_handler_data_t data;
            // data.data[0] = x->memory.data[0];
            // data.data[1] = x->memory.data[1];
            // Serial.println(data.value);
            // data.data[0] = x->memory.data[2];
            // data.data[1] = x->memory.data[3];
            // Serial.println(data.value);

class DispatcherHandler : public Scheduler
{
public:

DispatcherHandler(I2CSlave& i2c_slave,DataStorage& _ds,SMCEngine& smcEngine,SMC& smc);
~DispatcherHandler();

void begin();
void schedule() override;
void update() override;
void dispatch(uint8_t* data,size_t size){}
void cleanup()override;

data_storage_reg_read_t& get_reg_data(uint8_t reg_address);
private:
I2CSlave& _i2c_slave;
DataStorage& _ds;
SMCEngine& _smcEngine;
SMC& _smc;
data_storage_reg_read_t _reg_read;
os::memory_pool_t::memory_node_t _reg_data_read;


};


#endif